package com.example.kotlindemo

import java.lang.Exception

sealed class ResultSecond{
    data class Success(val msg:String):ResultSecond()

    sealed class Error(val error:Throwable):ResultSecond(){
        class SystemError(exception: Exception):Error(exception)
        class NetError(exception: Exception):Error(exception)
    }

    object  NoResponse:ResultSecond()



}

//fun getResult2(result: ResultSecond) = when (result){
//    is Success -> result.msg
//    is Error -> result.error.stackTrace
////    else -> throw IllegalAccessException()
//    ResultSecond.NoResponse -> println(result)
//}




